#include<bits/stdc++.h>
using namespace std;

void Merge(int SR[],int TR[],int s,int m,int e){
    int i=s,j=m+1,k=s,temp;
    while(i<=m&&j<=e){
        if(SR[i]>SR[j]){
            TR[k++] = SR[j++];
        }else{
            TR[k++] = SR[i++];
        }
    }
    while(i<=m){
        TR[k++] = SR[i++];
    }
    while(j<=e){
        TR[k++] = SR[j++];
    }
    return;
}

void Sort(int TR[],int start,int end,int SR[]){
    while(start<end){
        int mid = (end+start)/2;
        Sort(TR,start,mid,SR);
        Sort(TR,mid+1,end,SR);
        Merge(SR,TR,start,mid,end);
    }
}

void MergeSort(int a[],int b[],int length){
    Sort(a,0,length,b);
}